package DEMO;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;

/**
 * @author Lzm
 * @version 1.0
 */
public class CollectionTest {
  public static void main(String[] args) {
    Map<String,Object> map = new HashMap<>();
    Set<Map.Entry<String, Object>> entries = map.entrySet();
    for (Map.Entry<String, Object> entry : entries) {
      System.out.println(entry.getKey());
      System.out.println(entry.getValue());
    }
    Set<String> keys = map.keySet();
    for (String key : keys) {
      map.get(key);
    }
    ArrayList<Integer> list = new ArrayList<>();
    List<Integer> list1 = Collections.synchronizedList(list);
    Map<String,Object> map1 = new ConcurrentHashMap<>();


    list.add(1);
    list.add(2);
    list.add(3);
    list.add(4);

    Iterator<Integer> iterator = list.iterator();
    while(iterator.hasNext()){
      Integer next = iterator.next();
      if (next == 4){
        iterator.remove();
      }
    }
    System.out.println(list.size());

  }

}
